package com.tledu.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.tledu.commont.ReqVo;
import com.tledu.mapper.CourseMapper;
import com.tledu.mapper.SectionMapper;
import com.tledu.pojo.Course;
import com.tledu.pojo.Section;
import com.tledu.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService {

    @Override
    public Map<String, Object> find(ReqVo reqVo) {
        Page<Course> page = PageHelper.startPage(reqVo.getPageNow(),reqVo.getPageSize());
        List<Course> pageList = this.baseMapper.getPageList(reqVo.getCourse_title(), reqVo.getSubject_title());
        Map<String,Object> map = new HashMap();
        map.put("count",page.getTotal());//获得总共的数目
        map.put("list",pageList);//获得当前页的数据
        return map;
    }
}
